dir="/opt/scripts/db/"
filename="${dir}db_time.$(date "+%Y-%m-%d").sql"

mysqldump --database db_time -u root -proot > $filename

# 获取日期
d=`date -d "-10 day" +%Y-%m-%d`
# 删除10天前的备份文件
del_file="${dir}db_time.${d}.sql"
rm -rf $del_file